/*
 * @lc app=leetcode.cn id=217 lang=cpp
 *
 * [217] 存在重复元素
 */

#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <limits.h>
using namespace std;

// @lc code=start
class Solution {
public:
    bool containsDuplicate(vector<int>& nums) {
        set<int> number;
        bool result = false;

        for (int num:nums) {
            if (number.count(num) > 0) {
                result = true;
                break;
            } else {
                number.insert(num);
            }
        }
        
        return result;
    }
};
// @lc code=end

